home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ShareWare OnLine 2
/
ShareWare OnLine Volume 2 (CMS Software)(1993).iso
/
cad
/
tek2400.zip
/
TEK2400.DOC
next >
Wrap
Text File
|
1993-01-04
|
37KB
|
949 lines
Tektronix 2400 Series Digital Oscilloscopes
_____________________________________________________________________________
Introduction:
This instrument module provides GPIB programming support for the
Tektronix 2400 series of digital oscilloscope - 2430A, 2432, and 2440. It
contains functions for opening, configuring, reading waveforms from, and
manipulating the cursor capabilities of the instrument.
_____________________________________________________________________________
Assumptions:
To successfully use this module, the following conditions must be met:
- one of the indicated scopes is connected to the GPIB.
- the GPIB address supplied to the initialize function must match
the current GPIB address of the scope.
- there is one unused device name in the handler.
_____________________________________________________________________________
LabWindows Libraries:
In order to use this instrument module outside of the LabWindows envi-
ronment, it must be linked with the following LabWindows libraries:
- Formatting and I/O
- GPIB
- Analysis
_____________________________________________________________________________
Error Codes:
All error codes are returned in a global integer variable whose name
depends on the language being used:
For QuickBASIC : tek2400.err%
For C : tek2400_err
A program should examine this variable after each function call is made
to determine if any errors occurred.
_____________________________________________________________________________
Function Tree Layout:
Initialize
Configure
Vertical
Horizontal
A Trigger
B Trigger
Auto Setup
Acquisition Settings
Save Settings
Read Waveform
Save to Reference
Measurement Functions
Setup Measurement
Read Measurement
Cursor Functions
Set Cursor
Read Cursor
Close
_____________________________________________________________________________
Function : Initialize
QuickBASIC Syntax : CALL tek2400.init(Addr%)
C Syntax : void tek2400_init(Addr);
int Addr;
Purpose : Initializes the 2340A on the GPIB
Parameter List : Addr - GPIB Address (0 to 30)
QuickBASIC Example : CALL tek2400.init(1)
C Example : tek2400_init(1);
Error Codes : The valid error codes for this function are:
0 : Success
-1 : GPIB Address out of range
220 : Unable to open instrument
223 : Device at specified address is not a 2400
series oscilloscope
230 : GPIB write error
231 : GPIB read error
233 : Unable to configure GPIB address
_____________________________________________________________________________
Function : Set Vertical Parameters
QuickBASIC Syntax : CALL tek2400.set.vertical (Channel%, VoltsDiv#, Cou%,_
Inv%, Fif%)
C Syntax : tek2400_set_vertical (Channel, VoltsDiv, Cou, Inv, Fif);
int Channel;
double VoltsDiv ;
int Cou;
int Inv;
int Fif ;
Purpose : Configures the vertical volts/division, input coupling,
invert setting, and input impedance of the scope.
Parameter List : Channel - channel of scope to configure
1 or 2
VoltDiv - volts per division setting
0.002 to 50.0, in 1-2-5 sequence
Cou - input coupling mode
0 : AC
1 : DC
2 : GND
Inv - invert off or on
0 : Off
1 : On
Fif - fifty-ohm input impedance off or on
0 : Off
1 : On
QuickBASIC Example : CALL tek2400.set.vertical(1, 10.0, 0, 0, 0)
C Example : tek2400_set_vertical(1, 10.0, 0, 0, 0);
Error Codes : The valid error codes for this function are:
0 : Success
-1 : Channel out of range
-2 : Volts/Div out of range
-3 : Coupling out of range
-4 : Invert out of range
-5 : Fifty-ohm Setting out of range
230 : GPIB write error
231 : GPIB read error
232 : Instrument not initialized
_____________________________________________________________________________
Function : Set Vertical Mode
QuickBASIC Syntax : CALL tek2400.set.vertical.mode (VertMode%)
C Example : tek2400_set_vertical_mode (VertMode);
int VertMode ;
Purpose : Configures the vertical display mode of the scope.
Parameter List : VertMode - the vertical display mode
0 : Channel 1 only
1 : Channel 2 only
2 : Channel 1 and 2
3 : Channel 1 Versus Channel 2 (XY)
QuickBASIC Example : CALL tek2400.set.vertical.mode(1)
C Example : tek2400_set_vertical_mode(1);
Error Codes : The valid error codes for this function are:
0 : Success
-1 : Vertical Mode out of range
230 : GPIB write error
232 : Instrument not initialized
_____________________________________________________________________________
Function : Set Multiply Mode
QuickBASIC Syntax : CALL tek2400.set.multiply (Mult%)
C Example : tek2400_set_multiply (Mult);
int Mult ;
Purpose : Turns multiply mode off or on.
Parameter List : Mult - multiply mode off or on
0 : Off
1 : On
QuickBASIC Example : CALL tek2400.set.multiply(1)
C Example : tek2400_set_multiply(1);
Error Codes : The valid error codes for this function are:
0 : Success
-1 : Multiply out of range
230 : GPIB write error
232 : Instrument not initialized
_____________________________________________________________________________
Function : Set Add Mode
QuickBASIC Syntax : CALL tek2400.set.add (Add%)
C Example : tek2400_set_add (Add);
int Add ;
Purpose : Turns add mode off or on.
Parameter List : Add - add mode off or on
0 : Off
1 : On
QuickBASIC Example : CALL tek2400.set.add(1)
C Example : tek2400_set_add(1);
Error Codes : The valid error codes for this function are:
0 : Success
-1 : Add out of range
230 : GPIB write error
232 : Instrument not initialized
_____________________________________________________________________________
Function : Set Bandwidth
QuickBASIC Syntax : CALL tek2400.set.bw (BW)
C Example : tek2400_set_bw (BW);
int BW ;
Purpose : Sets the bandwidth of the scope.
Parameter List : BW - the desired bandwidth setting
0 : Full
1 : 50 MHz for 2430A/2432
100 MHz for 2440
2 : 20 MHz
QuickBASIC Example : CALL tek2400.set.bw(1)
C Example : tek2400_set_bw(1);
Error Codes : The valid error codes for this function are:
0 : Success
-1 : Bandwidth out of range
230 : GPIB write error
232 : Instrument not initialized
_____________________________________________________________________________
Function : Set Horizontal Parameters
QuickBASIC Syntax : CALL tek2400.set.horizontal (HorMode%, ASecDiv#, _
BSecDiv#, Delay#, Pos%)
C Syntax : tek2400_set_horizontal (HorMode, ASecDiv, BSecDiv,
Delay, Pos)
int HorMode ;
double ASecDiv ;
double BSecDiv ;
double Delay ;
int Pos ;
Purpose : Configures the horizontal mode, sweep time for time-
base A and B, the delay, and position
Parameter List : HorMode - the horizontal mode
0 : A mode
1 : A with B intensified
2 : B mode
ASecDiv - seconds per division for timebase A
2430A : 5 nS to 5 s
2432, 2440 : 2 nS to 5 s
BSecDiv - seconds per division for timebase B
All scopes : 5 nS to 5 s
Delay - delay time used by B timebase relative to A
dependent upon scope and BSecDiv; refer to the
user manual for your scope
Pos - horizontal position of traces on the display
0 to 1023
QuickBASIC Example : CALL tek2400.set.horzontal(1,10.0e-6, 100.e-6, 1.0e-3,_
512)
C Example : tek2400_set_horizontal(1, 10.0e-6, 100.e-6, 1.0e-3,512);
Error Codes : The valid error codes for this function are:
0 : Success
-1 : Vertical Mode out of range
-2 : A Sec/Div out of range
-3 : B Sec/Div out of range
-4 : Delay out of range
-5 : Position out of range
230 : GPIB write error
231 : GPIB read error
232 : Instrument not initialized
_____________________________________________________________________________
Function : Set A Trigger
QuickBASIC Syntax : CALL tek2400.set.a.trigger (Level#, Slope%, TPos%,_
Mode%, Source%, Cou%)
C Syntax : tek2400_set_a_trigger (Level, Slope, TPos, Mode,
Source, Cou);
double Level ;
int Slope ;
int TPos ;
int Mode ;
int Source ;
int Cou ;
Purpose : Configures the A trigger settings of the scope.
Parameter List : Level - trigger level in volts
Slope - determines whether trigger occurs on rising
(positive) or falling (negative) transition of trigger
signal
0 : Negative
1 : Positive
TPos - number of data points acquired prior to trigger
with (1023 -[Tpos * 32]) points acquired after trigger
1 to 30
Mode - trigger mode for trigger A
0 : Auto level
1 : Auto
2 : Normal
3 : Single
Source - source for A trigger signal
0 : Vertical
1 : Ch 1
2 : Ch 2
3 : External 1
4 : External 2
5 : Line
6 : Word
Cou - input coupling for A trigger signal input
0 : DC
1 : AC
2 : Noise reject
3 : HF reject
4 : LF reject
QuickBASIC Example : CALL tek2400.set.a.trigger (2.0, 0, 31, 0, 1, 1)
C Example : tek2400_set_a_trigger (2.0, 0, 31, 0, 1, 1);
Error Codes : The valid error codes for this function are:
0 : Success
-1 : Level out of range
-2 : Slope out of range
-3 : Trigger Position out of range
-4 : Mode out of range
-5 : Source out of range
-6 : Coupling out of range
230 : GPIB write error
231 : GPIB read error
232 : Instrument not initialized
_____________________________________________________________________________
Control Name: Ext1 / 5
Variable Type: Integer
Valid Values: 0 Do not divide by 5
_____________________________________________________________________________
Function : Set Gain of External input 1
QuickBASIC Syntax : CALL tek2400.set.ext1.div5 (Div5%)
C Example : tek2400_set_ext1_div5 (Div5);
int Div5;
Purpose : Indicates whether or not to divide the signal from
External input 1 by a factor of 5.
Parameter List : Div5
0 : Do not divide by 5
1 : Divide by 5
QuickBASIC Example : CALL tek2400.set.ext1.div5(1)
C Example : tek2400_set_ext1_div5(1);
Error Codes : The valid error codes for this function are:
0 : Success
-1 : Div5 out of range
230 : GPIB write error
232 : Instrument not initialized
_____________________________________________________________________________
Function : Set Gain of External input 2
Purpose : Indicates whether or not to divide the signal from
External input 2 by a factor of 5.
QuickBASIC Syntax : CALL tek2400.set.ext2.div5 (Div5%)
C Example : tek2400_set_ext2_div5 (Div5);
int Div5;
Parameter List : Div5
0 : Do not divide by 5
1 : Divide by 5
QuickBASIC Example : CALL tek2400.set.ext2.div5(1)
C Example : tek2400_set_ext2_div5(1);
Error Codes : The valid error codes for this function are:
0 : Success
-1 : Div5 out of range
230 : GPIB write error
232 : Instrument not initialized
_____________________________________________________________________________
Function : Set B Trigger
QuickBASIC Syntax : CALL tek2400.set.b.trigger (Level#, Slope%, TPos%, _
Mode%, Source%, Cou%)
C Syntax : tek2400_set_a_trigger (Level, Slope, TPos, Mode,
Source, Cou);
double Level ;
int Slope ;
int TPos ;
int Mode ;
int Source ;
int Cou ;
Purpose : Configures the B trigger settings of the scope.
Parameter List : Level - trigger level in volts
Slope - determines whether trigger occurs on rising
(positive) or falling (negative) transition of trigger
signal
0 : Negative
1 : Positive
TPos - number of data points acquired prior to trigger
with (1023 -[Tpos * 32]) points acquired after trigger
1 to 30
Mode - selects whether B sweep free-runs or must be
triggered to run
0 : Free run
1 : Trigger required
Source - source for B trigger signal
0 : Vertical
1 : Ch 1
2 : Ch 2
3 : External 1
4 : External 2
5 : Word
Cou - input coupling for B trigger signal input
0 : DC
1 : AC
2 : Noise reject
3 : HF reject
4 : LF reject
QuickBASIC Example : CALL tek2400.set.b.trigger (2.0, 0, 31, 0, 1, 1)
C Example : tek2400_set_b_trigger (2.0, 0, 31, 0, 1, 1);
Error Codes : The valid error codes for this function are:
0 : Success
-1 : Level out of range
-2 : Slope out of range
-3 : Trigger Position out of range
-4 : Mode out of range
-5 : Source out of range
-6 : Coupling out of range
230 : GPIB write error
231 : GPIB read error
232 : Instrument not initialized
_____________________________________________________________________________
Function : Auto Setup
QuickBASIC Syntax : CALL tek2400.auto.setup (Mode%, Resolution%)
C Syntax : tek2400_auto_setup (Mode, Resolution)
int Mode ;
int Resolution ;
Purpose : Causes scope to automatically adjust vertical, hori-
zontal, and trigger parameters to display the input
waveform
Parameter List : Mode - specifies the characteristic of the input signal
to use for optimizing the setup of the scope
0 : View
1 : Period
2 : Rise
3 : Fall
4 : Pulse
Resolution - when set to HI, causes waveform to be
spread over entire 20 division acquisition window;
LO results in optimization of horizontal resolution
to fit the waveform on the scope screen
0 : HI
1 : LO
QuickBASIC Example : CALL tek2400.auto.setup(0, 1)
C Example : tek2400_auto_setup(0, 1);
Error Codes : The valid error codes for this function are:
0 : Success
-1 : Mode out of range
-2 : Resolution out of range
230 : GPIB write error
232 : Instrument not initialized
_____________________________________________________________________________
Function : Set Acquisition Parameters
QuickBASIC Syntax : CALL tek2400.acq.set (AcqMode%, Delta%, Rep%, Env%, _
Avg%, Ref1%, Ref2%,Ref3%, Ref4%, RunMode%)
C Syntax : tek2400_acq_set (AcqMode, Delta, Rep, Env, Avg, Ref1,
Ref2, Ref3, Ref4, RunMode);
int AcqMode;
int Delta;
int Rep;
int Env;
int Avg;
int Ref1;
int Ref2;
int Ref3;
int Ref4;
int RunMode;
Parameter List : AcqMode - sets the acquisition mode to normal, enve-
lope, or average
0 : Normal
1 : Envelope
2 : Average
Delta - turns Save-On-Delta mode off or on
0 : Save-On-Delta off
1 : Save-On-Delta on
Rep - turns repetitive sampling mode off or on
0 : Repetitive mode off
1 : Repetitive mode on
Env - sets the number of acquisitions over which
which to accumalate envlopes (maximum and
minimum values).
0 : continuous
1 to 256, powers of 2 : number of envelopes
Avg - number of sweeps to average before starting over
2 to 256, powers of 2
Ref1 - specifies whether or not Reference 1 is
displayed
0 : Do not display
1 : Display
Ref2 - specifies whether or not Reference 2 is
displayed
0 : Do not display
1 : Display
Ref3 - specifies whether or not Reference 3 is
displayed
0 : Do not display
1 : Display
Ref4 - specifies whether or not Reference 4 is
displayed
0 : Do not display
1 : Display
RunMode - sets the action to occur when the function
is executed
0 : Leave current setting
1 : Start an acquisition
2 : Change to Save Mode
QuickBASIC Example : CALL tek2400.acq.set (0, 0, 1, 1, 2, 0, 0, 0, 0, 0)
C Example : tek2400_acq_set (0, 0, 1, 1, 2, 0, 0, 0, 0, 0);
Error Codes : The valid error codes for this function are:
0 : Success
-1 : Acquisition Mode out of range
-2 : Save-on-Delta out of range
-3 : Repetitive Mode out of range
-4 : Envelopes out of range
-5 : Averages out of range
-6 : Ref1 out of range
-7 : Ref2 out of range
-8 : Ref3 out of range
-9 : Ref4 out of range
-10 : Run Mode out of range
230 : GPIB write error
232 : Instrument not initialized
_____________________________________________________________________________
Function : Save Settings
QuickBASIC Syntax : CALL tek2400.save.set(Filename$, Read/write%)
C Syntax : void tek2400_save_set(Filename, Read/Write);
char *Filename;
int Read/Write;
Purpose : Reads acquisition settings from a file and sends them
to the scope or writes the current acquisition
settings of the scope to a file depending on the
Read/Write mode.
Parameter List : Filename - specifies the name of the file from which
to read or write.
Read/Write - specifies whether to read settings from
file or to write current settings to file.
QuickBasic Example : CALL tek2400.save.set ("tek2400.set", 0)
C Example : tek2400_save_set ("tek2400.set", 0);
Error Codes : The valid error codes for this function are:
-1 : Read/Write out of range
-2 : Error reading or writing to file
-230 : GPIB write error
-231 : GPIB read error
-232 : Instrument is not initialized
400 : Error in opening or closing a file
401 : Error in reading from or writing to
a file
_____________________________________________________________________________
Function : Read Waveform
QuickBASIC Syntax : CALL tek2400.read.wfm(Source%,Wfm#(),SamplePer#, TrigPos#)
C Syntax : void tek2400_read_wfm(Source,Wfm,SamplePer,TrigPos);
int Source;
double Wfm[1024];
double *SamplePer ;
double *TrigPos ;
Purpose : Reads a waveform from an acquisition source or from a
reference location.
Parameter List : Source - specifies the source of the waveform
1 : Acquire from Channel 1
2 : Acquire from Channel 2
3 : Acquire waveform from Add operation
4 : Acquire waveform from Multiply operation
5 : Read Ref 1
6 : Read Ref 2
7 : Read Ref 3
8 : Read Ref 4
Wfm - a real array variable in which the wave-
form data is returned. This array must
be at least 1024 elements long.
SamplePer - a real variable in which the value
of the sampling period used by the
oscilloscope to digitize the wave-
form is returned.
TrigPos - a real variable indicating the position of
the trigger point in the waveform, i.e. the
sample number representing time 0.
QuickBASIC Example : DIM wfm.data#(1024)
CALL tek2400.read.wfm(1,wfm.data#(),period#, t.zero#)
C Example : double period;
double t_zero ;
double wfm_data[1024];
tek2400_read_wfm(1,wfm_data,&period, &t_zero);
Error Codes : The valid error codes for this function are:
0 : Success
-1 : Source out of range
230 : GPIB write error
231 : GPIB read error
232 : Instrument not initialized
300 : Specified waveform source is not valid for
current instrument configuration
_____________________________________________________________________________
Function : Save to Reference
QuickBASIC Syntax : CALL tek2400.save.to.reference(Source%,Destination%)
C Syntax : void tek2400_save_to_reference(Source,Destination);
int Source;
int Destination ;
Purpose : Saves a waveform to a reference location.
Parameter List : Source - specifies the source of the waveform
1 : Acquire from Channel 1
2 : Acquire from Channel 2
3 : Acquire waveform from Add channel
4 : Acquire waveform from Multiply channel
5 : Ref 1
6 : Ref 2
7 : Ref 3
8 : Ref 4
Destination- specifies the location in which to save
the waveform
1 : Ref 1
2 : Ref 2
3 : Ref 3
4 : Ref 4
QuickBASIC Example : CALL tek2400.save.to.reference(1, 4)
C Example : tek2400_save_to_reference(1, 4);
Error Codes : The valid error codes for this function are:
0 : Success
-1 : Source out of range
-2 : Destination out of range
230 : GPIB write error
231 : GPIB read error
232 : Instrument not initialized
300 : Specified waveform source is not valid for
current instrument configuration
_____________________________________________________________________________
Function : Setup Measurement
QuickBASIC Syntax : CALL tek2400.setup.measurement(Window%, Method%, Mark%)
C Syntax : tek2400_setup_measurement (Window, Method, Mark);
int Window ;
int Method ;
int Mark ;
Purpose : Configures the parameters for taking measurements.
Parameter List : Window - turns measurement window off or on
0 : window off
1 : window on
Method - selects the method for determining Top and
Bottom of the waveform for measurements
0 : Min/Max
1 : Histogram
2 : Cursor (uses the current Volts cursor values)
Mark - turns the display threshold crossing marks on
or off
0 : marks off
1 : marks on
0 : Volts
QuickBASIC Example : CALL tek2400.setup.measurement (0, 1, 0)
C Example : tek2400_setup_measurement (0, 1, 0);
Error Codes : The valid error codes for this function are:
0 : Success
-1 : Window out of range
-2 : Method out of range
-3 : Mark out of range
230 : GPIB write error
232 : Instrument not initialized
_____________________________________________________________________________
Function : Read Measurement
QuickBASIC Syntax : CALL tek2400.read.measurement(Source%, Type%, Reading#)
C Syntax : tek2400_read_measurement (Source, Type, Reading);
int Source ;
int Type ;
double *Reading ;
Purpose : Returns a single measurement.
Parameter List : Source - specifies the location of the waveform on
which a measurement is made
1 : Chan 1
2 : Chan 2
3 : Add channel
4 : Multiply channel
Type - specifies the type of measurement to take
0 : Distal
1 : Mesial
2 : Proximal
3 : Max
4 : Mid
5 : Min
6 : Peak-to-Peak
7 : Top
8 : Base
9 : Mean
10 : Overshoot
11 : Undershoot
12 : RMS
13 : Area
14 : Width
15 : Duty
16 : Frequency
17 : Period
18 : Rise time
19 : Fall time
20 : Delay
Reading - real variable to contain the measurement
QuickBASIC Example : CALL tek2400.read.measurement (1, 0, reading#)
C Example : double reading ;
tek2400_read_measurement (1, 0, &reading);
Error Codes : The valid error codes for this function are:
0 : Success
-1 : Source out of range
-2 : Type out of range
230 : GPIB write error
231 : GPIB read error
232 : Instrument not initialized
300 : Specified waveform source is not valid for
current instrument configuration
_____________________________________________________________________________
Function : Set Cursor
QuickBASIC Syntax : CALL tek2400.set.cursor(OnOff%,Type%,Units%,Mode%)
C Syntax : void tek2400_set_cursor(OnOff,Type,Units,Mode);
int OnOff;
int Type;
int Units;
int Mode;
Purpose : Configures the cursor parameters to the specified
values and then places the instrument in local
mode.
Parameter List : OnOff - cursors on/off mode
0 : cursors off
1 : cursors on
Type - measurement type
0 : Volts
1 : Time
2 : 1/Time
3 : Slope
Units - measurement units
0 : Volts, Seconds, Hertz, or Volts/Second
1 : Percent
2 : dB or Degrees
Mode - measurement mode
0 : Absolute
1 : Delta
QuickBASIC Example : CALL tek2400.set.cursor(1,0,0,0);
C Example : tek2400_set_cursor(1,0,0,0);
Error Codes : The valid error codes for this function are:
0 : Success
-1 : On/Off out of range
-2 : Type out of range
-3 : Units out of range
-4 : Mode out of range
230 : GPIB write error
232 : Instrument not initialized
234 : Unable to place instrument in local mode
_____________________________________________________________________________
Function : Read Cursor
QuickBASIC Syntax : CALL tek2400.read.cursor(Value#)
C Syntax : void tek2400_read_cursor(Value);
double *Value;
Purpose : Returns the current cursor measurement.
Parameter List : Value - a real variable in which the value of
the cursor measurement is returned.
QuickBASIC Example : CALL tek2400.read.cursor(slope#);
C Example : double slope;
tek2400_read_cursor(&slope);
Error Codes : The valid error codes for this function are:
0 : Success
-1 : Cursors are turned off
230 : GPIB write error
231 : GPIB read error
232 : Instrument not initialized
234 : Unable to place instrument in local mode
_____________________________________________________________________________
Function : Close
QuickBASIC Syntax : CALL tek2400.close()
C Syntax : void tek2400_close();
Purpose : Effectively disconnects the 2340A from the GPIB
and returns the instrument to local mode.
Parameter List : NONE
QuickBASIC Example : CALL tek2400.close()
C Example : tek2400_close();
Error Codes : The valid error codes for this function are:
0 : Success
221 : Unable to close instrument
232 : Instrument not initialized
_____________________________________________________________________________